package com.platform.lxh.netty.model;

/**
 * @create: 2021-03-10 19:59
 * @author: xiaoh.luo001@bkjk.com
 * @description:
 **/
public enum MessageTypeEnum {

    REQUEST((byte) 1),
    RESPONSE((byte) 2),
    PING((byte) 3),
    PONG((byte) 4),
    EMPTY((byte) 5);

    private byte type;

    MessageTypeEnum(byte type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public static MessageTypeEnum get(byte type) {
        for (MessageTypeEnum value : values()) {
            if (value.type == type) {
                return value;
            }
        }

        throw new RuntimeException("unsupported type: " + type);
    }
}
